<template>
    <div style='width:100%;height:100%'>
        <cemetery-mx :gmTypes="gmType" :systemName="systemName" ref="cemeteryMx" @openWin="openWin" isTitle="Y" :isView="isView" :iszj="iszj" :iszp="iszp" :fileType="fileType" :fileName="fileName" :fileName2="fileName2"></cemetery-mx>
        <el-dialog
                v-el-drag-dialog
                :title="commonEditData.title"
                :modal="false"
                fullscreen="true"
                class="dialogClass dialog-vertical"
                style='left:0;top:0'
                center
                :visible.sync="dialogVisible3"
                >
                <common-edit :commonEditData="commonEditData"   @openWin="openWin2" @closeWin="closeWins" @goSearch="goSearch" v-if="dialogVisible3"></common-edit>
                
            </el-dialog>
         <el-dialog
                v-el-drag-dialog
                :title="commonEditData2.title"
                :modal="false"
                fullscreen="true"
                class="dialogClass dialog-vertical2"
                style='left:0;top:0'
                center
                :visible.sync="dialogVisible4"
                >
                <common-edit :commonEditData="commonEditData2"   @openWin="openWin2" @closeWin="closeWins2" @goSearch="goSearch" v-if="dialogVisible4"></common-edit>
                
            </el-dialog>

    </div>
</template>
<script>
import CemeteryMx  from '../../components/gm/CemeteryMx.vue'
import CommonEdit  from '../CommonEdit.vue'
export default {
    components: {
        CemeteryMx,
        CommonEdit
    },
    data(){
        return{
            commonEditData:{
                fieldPath:"",
                filename2:"",
                sId:"",
                param_key:"",
                appid:"",
                title:""
            },
             commonEditData2:{
                fieldPath:"",
                filename2:"",
                sId:"",
                param_key:"",
                appid:"",
                title:""
            },
            isView:"N",
            iszj:"N",
            iszp:"N",//是否需要显示照片
            fileType:"",
            fileName:"",
            fileName2:"",
            gmType:"",
            systemName:"",
            dialogVisible3:false,
            dialogVisible4:false,
            isApp:localStorage.getItem("isApp")
        }
    },
    created(){
        if(this.$route.query.isView){
            this.isView=this.$route.query.isView;
        }
        if(this.$route.query.iszj){
            this.iszj=this.$route.query.iszj;
        }
        if(this.$route.query.iszp){
            this.iszp=this.$route.query.iszp;
        }
        if(this.$route.query.fileType){
            this.fileType=this.$route.query.fileType;
        }
        if(this.$route.query.fileName){
            this.fileName=this.$route.query.fileName;
        }
        if(this.$route.query.fileName2){
            this.fileName2=this.$route.query.fileName2;
        }
        if(this.$route.query.gmType){
            this.gmType=this.$route.query.gmType;
        }
        if(this.$route.query.systemName){
            this.systemName=this.$route.query.systemName;
        }
       
    },
    methods:{
        openWin(data){
            if(this.isApp!="Y"){
                this.$emit("openWin",data)
            }else{
                console.log(data)
                let item=JSON.parse(data);
                this.dialogVisible3=true;
            
                this.commonEditData={
                    fieldPath:"",
                    filename2:"",
                    sId:"",
                    param_key:"",
                    appid:"",
                    title:"",
                    paramVals:""
                };
                this.commonEditData.fieldPath=item.fieldPath;
                this.commonEditData.filename2=item.filename2;
                this.commonEditData.appid=item.appid;
                this.commonEditData.param_key=item.param_key;
                this.commonEditData.title=item.buttonName;
                this.commonEditData.params=item.params;

                this.commonEditData.paramVals=item.paramVals;
                this.commonEditData.sId=item.sId;

                let els=document.getElementsByClassName("el-dialog");
                for(let i=0;i<els.length;i++){
                    els[i].style.left="0";
                    els[i].style.top="0"
                }
            }
        },
        openWin2(data){
            if(this.isApp!="Y"){
                this.$emit("openWin",data)
            }else{
                let item=JSON.parse(data);
                this.dialogVisible3=false;
                this.dialogVisible4=true;
            
                this.commonEditData2={
                    fieldPath:"",
                    filename2:"",
                    sId:"",
                    param_key:"",
                    appid:"",
                    title:"",
                    paramVals:""
                };
                this.commonEditData2.fieldPath=item.fieldPath;
                this.commonEditData2.filename2=item.filename2;
                this.commonEditData2.appid=item.appid;
                this.commonEditData2.param_key=item.param_key;
                this.commonEditData2.title=item.buttonName;
                this.commonEditData2.paramVals=item.paramVals;
                this.commonEditData2.sId=item.sId;

                let els=document.getElementsByClassName("el-dialog2");
                for(let i=0;i<els.length;i++){
                    els[i].style.left="0";
                    els[i].style.top="0"
                }
            }
        },
         closeWins(datas){
            this.dialogVisible3=false;
        },
          closeWins2(datas){
            this.dialogVisible4=false;
        },
        initData(){
            this.$refs.cemeteryMx.initData();
        },
        goSearch(){
            this.$refs.cemeteryMx.goSearch();
        }
    }
}
</script>
<style scoped>
.dialogClass{
        display:flex;
        flex-direction: column;
        overflow: hidden;
    }

    .dialogClass>>>.el-dialog{
        width:100%;
        flex:1;
        overflow:hidden !important;
        position:absolute !important;
        height:100%;
        display:flex;
        /*flex:1;
        overflow: hidden;
        height:100%;*/
    }
    .dialogClass>>>.el-dialog__body{
        overflow:hidden !important;
        flex:1;
    }
    
</style>